-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Beds 526/Raw DB sdk #947
base: staging
Are you sure you want to change the base?
Beds 526/Raw DB sdk #947
Conversation
e0b6374
to
1fdf888
Compare
86d3841
to
cd8bbcb
Compare
cd8bbcb
to
907dd8c
Compare
db2/BigTableEthRaw: add chainID db2/BigTableEthRaw: handle index for get uncle db2/BigTableEthRaw: fix with empty tx db2/BigTableEthRaw: add real condition test db2/BigTableEthRaw: add WithFallback db2/BigTableEthRaw: fallback for unsupported method db2: add cache to raw store (#966) db2: better cache + client + update store bigtable + clean up db2/raw: add EthParse
a3eb57f
to
d7ad639
Compare
c0ec2bc
to
2657fae
Compare
|
||
- solc is available [here](https://docs.soliditylang.org/en/latest/installing-solidity.html) | ||
|
||
- and `abigen` wan be installed through go directly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- and `abigen` wan be installed through go directly | |
- and `abigen` can be installed through go directly |
|
||
head, _ := b.Backend.Client().HeaderByNumber(context.Background(), nil) | ||
gasPrice := new(big.Int).Add(head.BaseFee, big.NewInt(params.GWei)) | ||
chainid, _ := b.Backend.Client().ChainID(context.Background()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chainid, _ := b.Backend.Client().ChainID(context.Background()) | |
chainid, err := b.Backend.Client().ChainID(context.Background()) |
func (b *BlockchainBackend) MakeUnsignedTx(t *testing.T, from common.Address, to *common.Address, value *big.Int, data []byte) *types.Transaction { | ||
t.Helper() | ||
|
||
head, _ := b.Backend.Client().HeaderByNumber(context.Background(), nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
head, _ := b.Backend.Client().HeaderByNumber(context.Background(), nil) | |
head, err := b.Backend.Client().HeaderByNumber(context.Background(), nil) |
we should check for any errors coz we will be accessing the BaseFee value to calculate the gas price
func (b *BlockchainBackend) DeployContract(t *testing.T, contractData []byte) common.Address { | ||
t.Helper() | ||
|
||
head, _ := b.Backend.Client().HeaderByNumber(context.Background(), nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
head, _ := b.Backend.Client().HeaderByNumber(context.Background(), nil) | |
head, err := b.Backend.Client().HeaderByNumber(context.Background(), nil) |
|
||
head, _ := b.Backend.Client().HeaderByNumber(context.Background(), nil) | ||
gasPrice := new(big.Int).Add(head.BaseFee, big.NewInt(params.GWei)) | ||
chainid, _ := b.Backend.Client().ChainID(context.Background()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chainid, _ := b.Backend.Client().ChainID(context.Background()) | |
chainid, err := b.Backend.Client().ChainID(context.Background()) |
bk := ethsimtracer.NewBackend(genesis, func(nodeConf *node.Config, ethConf *ethconfig.Config) { | ||
nodeConf.HTTPModules = append(nodeConf.HTTPModules, "debug", "eth") | ||
nodeConf.HTTPHost = "127.0.0.1" | ||
nodeConf.HTTPPort = 4242 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be a good idea to move the port value to the top of the file and store it as a constant - it will make it easier to update when needed
return fmt.Errorf("cannot ApplyBulk err: %w", err) | ||
} | ||
// TODO aggregate errs | ||
for _, e := range errs { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for _, e := range errs { | |
var bulkErrs []string | |
for _, e := range errs { | |
bulkErrs = append(bulkErrs, e.Error()) | |
} | |
if len(bulkErrs) > 0 { | |
return fmt.Errorf("cannot ApplyBulk elem, errors: %v", bulkErrs) | |
} |
if err != nil { | ||
return fmt.Errorf("cannot ApplyBulk err: %w", err) | ||
} | ||
// TODO aggregate errs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// TODO aggregate errs |
// Close shuts down the BigTable by closing the Bigtable client connection | ||
// It returns an error if the operation fails | ||
func (b BigTable) Close() error { | ||
if err := b.client.Close(); err != nil && status.Code(err) != codes.Canceled { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's also check if the client is not nil before trying to close it
}, { | ||
key: "bar", | ||
}}, | ||
expected: []string{"", "", "", ""}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this correct expected output?
if err != nil { | ||
t.Fatal(err) | ||
} | ||
ctx := context.Background() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ctx := context.Background() | |
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) | |
defer cancel() |
} | ||
|
||
func (s *SenderFromDBSigner) ChainID() *big.Int { | ||
panic("can't sign with SenderFromDBSigner") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
panic("can't sign with SenderFromDBSigner") | |
panic("can't sign with SenderFromDBSigner: ChainID method not supported") |
panic("can't sign with SenderFromDBSigner") | ||
} | ||
func (s *SenderFromDBSigner) Hash(tx *types.Transaction) common.Hash { | ||
panic("can't sign with SenderFromDBSigner") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
panic("can't sign with SenderFromDBSigner") | |
panic("can't sign with SenderFromDBSigner: Hash method not supported") |
panic("can't sign with SenderFromDBSigner") | ||
} | ||
func (s *SenderFromDBSigner) SignatureValues(tx *types.Transaction, sig []byte) (R, S, V *big.Int, err error) { | ||
panic("can't sign with SenderFromDBSigner") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
panic("can't sign with SenderFromDBSigner") | |
panic("can't sign with SenderFromDBSigner: SignatureValues method not supported") |
// copy of senderFromServer | ||
// https://github.com/ethereum/go-ethereum/blob/v1.14.11/ethclient/signer.go#L30 | ||
type SenderFromDBSigner struct { | ||
addr common.Address |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addr common.Address | |
Address common.Address |
// https://github.com/ethereum/go-ethereum/blob/v1.14.11/ethclient/signer.go#L30 | ||
type SenderFromDBSigner struct { | ||
addr common.Address | ||
Blockhash common.Hash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blockhash common.Hash | |
BlockHash common.Hash |
Input string | ||
Output string | ||
Error string | ||
RevertReason string // todo have a look at this, it could improve revert message |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RevertReason string // todo have a look at this, it could improve revert message | |
RevertReason string // todo have a look at this, it could improve revert message |
Is this comment still needed or can we remove it?
@Tangui-Bitfly Can you update the PR title to align with the template and to reflect the issue being addressed? Thanks! ^^ |
db2.BigTableEthRaw
which only purpose is reading from the raw bigtable storedb2.BigTableEthRaw
is ahttp.RoundTriper
, this allow the caller to use when creating a newethclient.Client
db2.RawStore
to handle all interaction with bigtable satore. There are some duplications here, the aim of this pr is not to refactor everything, it's just to provide an easy to use way of retrieving eth data from bigtable